package net.zjitc.redis7_study.demo;/**
 * @Author 董熠涛
 * @Date 2025/4/1  21:12
 */

import io.lettuce.core.RedisClient;
import io.lettuce.core.RedisURI;
import io.lettuce.core.api.StatefulRedisConnection;
import io.lettuce.core.api.sync.RedisCommands;

/**
 * @Author:董熠涛
 * @ 2025/4/121:12
 */
public class LettuceDemo {
    public static void main(String[] args) {
//        使用构建器链式编程来builder我们RedisURI
        RedisURI uri = RedisURI.builder()
                .redis("192.168.11.128")
                .withPort(6379)
                .withAuthentication("default", "123456")
                .build();
//      创建连接客户端
        RedisClient redisClient = RedisClient.create(uri);
        StatefulRedisConnection<String, String> connect = redisClient.connect();
//      通过connect创建操作的command
        RedisCommands<String, String> commands = connect.sync();

        System.out.println(commands.ping());
    }
}
